#!/usr/local/bin/perl
# My downloader script originally wrote the downloaded html files as 
# *.txt.  As I wanted to be able to easily display them in the browser while 
# testing, I modified the downloader to name them *.html.  However, I still had 
# several gigs of *.txt patents on my hands that had already been downloaded
# so I needed a script to rename them all.

#my @mydirs = <(\d*)>;
#print "mydirs: @mydirs";

foreach $d (glob('*'))
{
	if(-d $d)
	{
		## ensures that the path ends with a /
		$d .= '/' if(($path !~ /\/$/) || ($path !~ /\\$/));
		
		my @myfiles = glob($d."*.txt");
		#print "$d/*.txt\n";
		foreach $f (@myfiles)
		{
			#print "Doing $f\n";
			my $newname = $f;
			$newname =~ s/\.txt/\.html/;
			rename("$f", "$newname");
			print "$f renamed $newname\n";
		}
	}
}
